package soucet;

import java.util.Random;
import java.util.Scanner;

public class Soucet
{
	private static int num = 0;
	private static boolean player = true;

	public static void main(String[] args)
	{
		while (num < 100)
		{
			if (player)
				player();
			else
				computer();
		}
		
		if (player)
			System.out.println("Player have won.");
		else
			System.out.println("Computer have won.");
	}

	private static void computer()
	{
		Random rnd = new Random();
		num = num + (rnd.nextInt(9) + 1);
		player = !player;
		System.out.println(num);
	}

	private static void player()
	{
		boolean control = true;
		int num2 = 0;
		while (control)
		{
			try
			{

				Scanner sc = new Scanner(System.in);
				num2 = sc.nextInt();
				if (num2 > 9)
				{
					System.out.println("Number have to be lower than 10");

				}
				else
				{
					num = num + num2;
					control = false;
					player = !player;
				}
			}
			catch (Exception e)
			{
			}
		}
	}
}
